package com.semanticbits.codejam.model

/**
 * Created by IntelliJ IDEA.
 * User: carlos.perez
 * Date: 1/15/11
 * Time: 1:02 PM
 * To change this template use File | Settings | File Templates.
 */

HudsonClient client = new HudsonClient();

//client.hudsonHost="localhost:8081";

app.Application.HUDSON_URL = "http://localhost:8081/hudson"
client.projectName = UUID.randomUUID();
client.hudsonHost = app.Application.HUDSON_URL

client.username = "username"
client.password = "password"
client.config_xml =
"""
<?xml version='1.0' encoding='UTF-8'?>
<project>
  <actions/>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties/>
  <scm class="hudson.scm.NullSCM"/>
  <canRoam>true</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers class="vector"/>
  <concurrentBuild>false</concurrentBuild>
  <builders>
    <hudson.tasks.Ant>
      <targets>-lib c:/java/aribaweb-5.0GA/codejammer/CodeJamManager/resource/webserver/mail/lib</targets>
      <buildFile>c:/java/aribaweb-5.0GA/codejammer/CodeJamManager/resource/webserver/mail/build.xml</buildFile>
    </hudson.tasks.Ant>
  </builders>
  <publishers/>
  <buildWrappers/>
</project>"""

client.createProject()

print "Success?"
println client.checkProject()

// if not immediate
client.build()

//client.deleteProject()
print "Deleted?"
println !client.checkProject()